<!-- 展开收起 -->
<template>
  <px-tooltip ref="tooltipRef" :content="`${expland ? '收起' : '展开'}`" placement="top">
    <div @click="handleClick" :class="['expland-icon', expland ? 'expland' : 'close', className]">
      <px-icon v-if="expland"><DArrowLeft /></px-icon>
      <px-icon v-else><DArrowRight /></px-icon>
    </div>
  </px-tooltip>
</template>
<script lang="ts" setup>
import { ref } from "vue";
const expland = defineModel();
defineProps(["className"]);
const tooltipRef = ref();
const handleClick = () => {
  expland.value = !expland.value;
  tooltipRef.value?.hide();
};
</script>
<style lang="scss" scoped>
.expland-icon {
  width: 20px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid #cccccc;
  position: absolute;
  right: 0;
  top: 17px;
  &:hover {
    border: 1px solid #3b82f6;
    color: #3b82f6;
  }
}
.expland {
  box-shadow:
    0px 2px 4px -1px rgba(0, 0, 0, 0.12),
    0px 4px 5px 0px rgba(0, 0, 0, 0.08);
  border-radius: 42px 0px 0px 42px;
}
.close {
  box-shadow:
    0px 2px 4px -1px rgba(0, 0, 0, 0.12),
    0px 4px 5px 0px rgba(0, 0, 0, 0.08);
  border-radius: 0px 100px 100px 0px;
}
</style>
